package pers.corvey.studyjava.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pers.corvey.studyjava.dao.CourseCategoryDAO;
import pers.corvey.studyjava.model.CourseCategory;

@Service
public class CourseCategoryService {

    @Autowired
    private CourseCategoryDAO courseCategoryDAO;
    
    public Iterable<CourseCategory> getCourseCategorys() {
        return courseCategoryDAO.findAll();
    }
    
    public CourseCategory getCourseCategoryById(String id) {
        return courseCategoryDAO.findOne(id);
    }
    
    public CourseCategory updateCourseCategory(CourseCategory courseCategory) {
        return courseCategoryDAO.save(courseCategory);
    }
    
    public boolean isCourseCategoryExists(String id) {
        return courseCategoryDAO.exists(id);
    }
    
}
